<?php
registerTable("resource_record", new table_resource_record());

class table_resource_record extends Database
{

    public function __construct()
    {
        parent::__construct("resource_record");
    }

    public function fetch_by_uid($uid)
    {
        return $this->fetch_assoc("`uid`='$uid'");
    }

    public function fetch_by_rid($rid)
    {
        return $this->fetch_assoc("`rid`='$rid'");
    }

    public function update_enable_state($rid, $state)
    {
        parent::update(array(
            "enable" => $state
        ), "`rid`='$rid'");
    }

    public function update_onlyupdatervisible_state($rid, $state)
    {
        parent::update(array(
            "onlyupdatervisible" => $state
        ), "`rid`='$rid'");
    }

    public function remove_by_rid($rid)
    {
        $this->remove("`rid`='$rid'");
    }

    public function count_by_md5($md5)
    {
        return $this->count_something("`md5`='$md5'");
    }
}